﻿/*
版权所有：版权所有(C) 2010，刘建新
文件编号：M01_BaseMyChatTools.cs
文件名称：BaseMyChatTools.cs
系统编号：Z0003007
系统名称：通用办公系统
模块编号：M01
模块名称：信息发布
设计文档：IOA_M01信息发布XDE建模.mdx
完成日期：2010/12/17
作　　者：
内容摘要：表[Base_My_Chat_Tools]对应的实体类
*/

using System;
using System.Collections;
using System.Data;


namespace Eis51.CampanyCMS.Model.OnlineService
{
		/// <summary>
		/// 类 编 号：
		/// 类 名 称：BaseMyChatTools
		/// 内容摘要：
		/// </summary>
		
		[Serializable]
		public class BaseMyChatTools : BaseModel
		{
		#region 自动生成代码
		
			#region 重载Equals/GetHashCode
			/// <summary>
			/// 重载Equals			
			/// </summary>
			public override bool Equals (Object obj)
			{
				if (obj != null && obj is BaseMyChatTools)
				{
					if (obj == this)
						return true;
					BaseMyChatTools castObj = (BaseMyChatTools)obj; 
					
					if (!this.m_BaseMyChatToolsId.Equals(castObj.BaseMyChatToolsId))
						return false;
						
					if (!this.m_ChatToolCode.Equals(castObj.ChatToolCode))
						return false;
						
					if (!this.m_ChatToolName.Equals(castObj.ChatToolName))
						return false;
						
					if (!this.m_ChatNum.Equals(castObj.ChatNum))
						return false;
						
					if (!this.m_ShowName.Equals(castObj.ShowName))
						return false;
						
					if (!this.m_ChatStyle.Equals(castObj.ChatStyle))
						return false;
						
					if (!this.m_Createby.Equals(castObj.Createby))
						return false;
						
					if (!this.m_LinkContent.Equals(castObj.LinkContent))
						return false;
						
					return true;
				}
				return false;
			}
			
			/// <summary>
			/// 重载GetHashCode
			/// </summary>
			public override int GetHashCode()
			{
					int hash = 0;					
					
					hash = hash <<  8;
					if ((object)m_BaseMyChatToolsId != null)
					{
						hash = hash ^ m_BaseMyChatToolsId.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_ChatToolCode != null)
					{
						hash = hash ^ m_ChatToolCode.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_ChatToolName != null)
					{
						hash = hash ^ m_ChatToolName.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_ChatNum != null)
					{
						hash = hash ^ m_ChatNum.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_ShowName != null)
					{
						hash = hash ^ m_ShowName.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_ChatStyle != null)
					{
						hash = hash ^ m_ChatStyle.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Createby != null)
					{
						hash = hash ^ m_Createby.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_LinkContent != null)
					{
						hash = hash ^ m_LinkContent.GetHashCode();
					}
						
					return hash; 
			}
			#endregion
			
			public BaseMyChatTools()
			{
				MarkNew();
			}						
			
			public BaseMyChatTools GetOldValue()
			{
				return OldValue as BaseMyChatTools;
			}
		
		#region BaseMyChatToolsId属性
			private int m_BaseMyChatToolsId = 0;
			/// <summary>
			/// 属性名称： BaseMyChatToolsId
			/// 内容摘要： DB列名：Base_My_Chat_Tools_ID[主键]
			///            DB类型：int
			/// </summary>
			public int BaseMyChatToolsId
			{
				get
					{
						return m_BaseMyChatToolsId;
					}
				set
					{
						if (m_BaseMyChatToolsId as object == null || !m_BaseMyChatToolsId.Equals(value))
						{
							m_BaseMyChatToolsId = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region ChatToolCode属性
			private string m_ChatToolCode = String.Empty;
			/// <summary>
			/// 属性名称： ChatToolCode
			/// 内容摘要： DB列名：Chat_Tool_CODE[工具CODE]
			///            DB类型：string
			/// </summary>
			public string ChatToolCode
			{
				get
					{
						return m_ChatToolCode;
					}
				set
					{
						if (m_ChatToolCode as object == null || !m_ChatToolCode.Equals(value))
						{
							m_ChatToolCode = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region ChatToolName属性
			private string m_ChatToolName = String.Empty;
			/// <summary>
			/// 属性名称： ChatToolName
			/// 内容摘要： DB列名：Chat_Tool_Name[聊天工具名]
			///            DB类型：string
			/// </summary>
			public string ChatToolName
			{
				get
					{
						return m_ChatToolName;
					}
				set
					{
						if (m_ChatToolName as object == null || !m_ChatToolName.Equals(value))
						{
							m_ChatToolName = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region ChatNum属性
			private string m_ChatNum = String.Empty;
			/// <summary>
			/// 属性名称： ChatNum
			/// 内容摘要： DB列名：Chat_Num[聊天账号]
			///            DB类型：string
			/// </summary>
			public string ChatNum
			{
				get
					{
						return m_ChatNum;
					}
				set
					{
						if (m_ChatNum as object == null || !m_ChatNum.Equals(value))
						{
							m_ChatNum = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region ShowName属性
			private string m_ShowName = String.Empty;
			/// <summary>
			/// 属性名称： ShowName
			/// 内容摘要： DB列名：Show_Name[显示名]
			///            DB类型：string
			/// </summary>
			public string ShowName
			{
				get
					{
						return m_ShowName;
					}
				set
					{
						if (m_ShowName as object == null || !m_ShowName.Equals(value))
						{
							m_ShowName = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region ChatStyle属性
			private string m_ChatStyle = String.Empty;
			/// <summary>
			/// 属性名称： ChatStyle
			/// 内容摘要： DB列名：Chat_Style[显示风格]
			///            DB类型：string
			/// </summary>
			public string ChatStyle
			{
				get
					{
						return m_ChatStyle;
					}
				set
					{
						if (m_ChatStyle as object == null || !m_ChatStyle.Equals(value))
						{
							m_ChatStyle = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Createby属性
			private string m_Createby = String.Empty;
			/// <summary>
			/// 属性名称： Createby
			/// 内容摘要： DB列名：Createby[创建人]
			///            DB类型：string
			/// </summary>
			public string Createby
			{
				get
					{
						return m_Createby;
					}
				set
					{
						if (m_Createby as object == null || !m_Createby.Equals(value))
						{
							m_Createby = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region LinkContent属性
			private string m_LinkContent = String.Empty;
			/// <summary>
			/// 属性名称： LinkContent
			/// 内容摘要： DB列名：Link_Content[nchar(10)]
			///            DB类型：string
			/// </summary>
			public string LinkContent
			{
				get
					{
						return m_LinkContent;
					}
				set
					{
						if (m_LinkContent as object == null || !m_LinkContent.Equals(value))
						{
							m_LinkContent = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region static CreateDataTable/FillDataRow/DataRow2Obj/Dt2Objs/FillDataTable
			/// <summary>
			/// 得到实体对应的DataTable
			/// </summary>
			/// <param name="tableName">表名</param>
			/// <param name="cne">列名映射选择:DB列名或属性名</param>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable(string tableName,ColumnNameEnum cne)
			{
				DataTable dtResult = new DataTable(tableName);
			
				if (cne == ColumnNameEnum.DBName)
				{
					dtResult.Columns.Add(new DataColumn("Base_My_Chat_Tools_ID",typeof(int)));
					dtResult.Columns.Add(new DataColumn("Chat_Tool_CODE",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Chat_Tool_Name",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Chat_Num",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Show_Name",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Chat_Style",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Createby",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Link_Content",typeof(string)));
				}
				else if (cne == ColumnNameEnum.PropertyName)
				{
					dtResult.Columns.Add(new DataColumn("BaseMyChatToolsId",typeof(int)));
					dtResult.Columns.Add(new DataColumn("ChatToolCode",typeof(string)));
					dtResult.Columns.Add(new DataColumn("ChatToolName",typeof(string)));
					dtResult.Columns.Add(new DataColumn("ChatNum",typeof(string)));
					dtResult.Columns.Add(new DataColumn("ShowName",typeof(string)));
					dtResult.Columns.Add(new DataColumn("ChatStyle",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Createby",typeof(string)));
					dtResult.Columns.Add(new DataColumn("LinkContent",typeof(string)));
				}
				return dtResult;
			}
			
			/// <summary>
			/// 得到实体对应的DataTable
			/// </summary>
			/// <param name="cne">列名映射选择:DB列名或属性名</param>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable(ColumnNameEnum cne)
			{
				return CreateDataTable(null,cne);
			}

			/// <summary>
			/// 得到实体对应的DataTable(默认列名映射为属性名)
			/// </summary>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable()
			{
				return CreateDataTable(ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 用当前对象值填充DaraRow
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			/// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
			public void FillDataRow(DataRow dr,ColumnNameEnum cne)
			{
				if (dr == null)
				{
					throw new ArgumentNullException("dr");
				}
				if (ColumnNameEnum.DBName == cne)
				{
					dr["Base_My_Chat_Tools_ID"] = this.BaseMyChatToolsId;
					dr["Chat_Tool_CODE"] = this.ChatToolCode;
					dr["Chat_Tool_Name"] = this.ChatToolName;
					dr["Chat_Num"] = this.ChatNum;
					dr["Show_Name"] = this.ShowName;
					dr["Chat_Style"] = this.ChatStyle;
					dr["Createby"] = this.Createby;
					dr["Link_Content"] = this.LinkContent;
				}
				else if (ColumnNameEnum.PropertyName == cne)
				{
					dr["BaseMyChatToolsId"] = this.BaseMyChatToolsId;
					dr["ChatToolCode"] = this.ChatToolCode;
					dr["ChatToolName"] = this.ChatToolName;
					dr["ChatNum"] = this.ChatNum;
					dr["ShowName"] = this.ShowName;
					dr["ChatStyle"] = this.ChatStyle;
					dr["Createby"] = this.Createby;
					dr["LinkContent"] = this.LinkContent;					
				}
			}
			
			/// <summary>
			/// 用当前对象值填充DaraRow(默认列名映射为属性名)
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			public void FillDataRow(DataRow dr)
			{
				this.FillDataRow(dr,ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 将DataRow转换成BaseMyChatTools对象
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			/// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
			/// <returns>BaseMyChatTools对象</returns>
			public static BaseMyChatTools Dr2Obj(DataRow dr,ColumnNameEnum cne)
			{
				if (dr == null)
				{
					throw new ArgumentNullException("dr");
				}
				BaseMyChatTools obj = new BaseMyChatTools();
				if (ColumnNameEnum.DBName == cne)
				{
					obj.BaseMyChatToolsId = (dr["Base_My_Chat_Tools_ID"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["Base_My_Chat_Tools_ID"],typeof(int));
					obj.ChatToolCode = (dr["Chat_Tool_CODE"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Chat_Tool_CODE"],typeof(string));
					obj.ChatToolName = (dr["Chat_Tool_Name"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Chat_Tool_Name"],typeof(string));
					obj.ChatNum = (dr["Chat_Num"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Chat_Num"],typeof(string));
					obj.ShowName = (dr["Show_Name"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Show_Name"],typeof(string));
					obj.ChatStyle = (dr["Chat_Style"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Chat_Style"],typeof(string));
					obj.Createby = (dr["Createby"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Createby"],typeof(string));
					obj.LinkContent = (dr["Link_Content"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Link_Content"],typeof(string));
				}
				else if (ColumnNameEnum.PropertyName == cne)
				{
					obj.BaseMyChatToolsId = (dr["BaseMyChatToolsId"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["BaseMyChatToolsId"],typeof(int));
					obj.ChatToolCode = (dr["ChatToolCode"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["ChatToolCode"],typeof(string));
					obj.ChatToolName = (dr["ChatToolName"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["ChatToolName"],typeof(string));
					obj.ChatNum = (dr["ChatNum"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["ChatNum"],typeof(string));
					obj.ShowName = (dr["ShowName"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["ShowName"],typeof(string));
					obj.ChatStyle = (dr["ChatStyle"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["ChatStyle"],typeof(string));
					obj.Createby = (dr["Createby"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Createby"],typeof(string));
					obj.LinkContent = (dr["LinkContent"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["LinkContent"],typeof(string));		
				}
				
				return obj;
			}
			
			/// <summary>
			/// 将DataRow转换成BaseMyChatTools对象(默认列名映射为属性名)
			/// </summary>
			/// <returns>BaseMyChatTools对象</returns>
			public static BaseMyChatTools Dr2Obj(DataRow dr)
			{
				return Dr2Obj(dr,ColumnNameEnum.DBName);
			}
			
			/// <summary>
			/// 将DataTabe转换成的BaseMyChatTools对象集合
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
			/// <returns>BaseMyChatTools对象的集合</returns>
			public static IList Dt2Objs(DataTable dt,ColumnNameEnum cne)
			{
				if (dt == null)
				{
					throw new ArgumentNullException("dt");
				}
				
				ArrayList alResult = new ArrayList();
				
				foreach(DataRow dr in dt.Rows)
				{
					alResult.Add(Dr2Obj(dr,cne));
				}
				
				return alResult;
			}

			/// <summary>
			/// 将DataTabe转换成的BaseMyChatTools对象集合(默认列名映射为属性名)
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <returns>BaseMyChatTools对象的集合</returns>
			public static IList Dt2Objs(DataTable dt)
			{
				return Dt2Objs(dt,ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 用objs的BaseMyChatTools对象集合填充DataTable
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="objs">BaseMyChatTools对象集合</param>
			/// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
			public static void FillDataTable(DataTable dt,IList objs,ColumnNameEnum cne)
			{
				if (dt == null)
				{
					throw new ArgumentNullException("dt");
				}
				if (objs == null)
				{
					throw new ArgumentNullException("objs");
				}
				
				foreach(BaseMyChatTools obj in objs)
				{
					DataRow dr = dt.NewRow();
					obj.FillDataRow(dr,cne);
					dt.Rows.Add(dr);
				}
			}

			/// <summary>
			/// 用objs的BaseMyChatTools对象集合填充DataTable(默认列名映射为属性名)
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="objs">BaseMyChatTools对象集合</param>
			public static void FillDataTable(DataTable dt,IList objs)
			{
				FillDataTable(dt,objs,ColumnNameEnum.PropertyName);
			}
		#endregion
		
		/// <summary>
		/// 取消编辑,恢复到上次有效调用BeginEdit前的状态,并清空保留值
		/// </summary>
		public override void CancelEdit()
		{
			BaseMyChatTools old = this.OldValue as BaseMyChatTools;
			if (old != null)
			{
					this.BaseMyChatToolsId = old.BaseMyChatToolsId;
					this.ChatToolCode = old.ChatToolCode;
					this.ChatToolName = old.ChatToolName;
					this.ChatNum = old.ChatNum;
					this.ShowName = old.ShowName;
					this.ChatStyle = old.ChatStyle;
					this.Createby = old.Createby;
					this.LinkContent = old.LinkContent;				
				this.OldValue = null;
			}
		}
		
		
		
		
		#region BaseMyChatTools实体的内部Key类
			/// <summary>
			/// BaseMyChatTools实体的Key类
			/// </summary>
			public sealed class Key
			{
		
				private int m_BaseMyChatToolsId;
				public int BaseMyChatToolsId
				{
 					get 
					{ 
						 return m_BaseMyChatToolsId; 
					}
					set 
					{ 
						m_BaseMyChatToolsId = value;
					}
				}
		
				public Key(int pBaseMyChatToolsId)
				{
					m_BaseMyChatToolsId=pBaseMyChatToolsId;

				}
			}
		#endregion
			/// <summary>
			/// 得到实体BaseMyChatTools的PK
			/// </summary>
			public Key GetKey()
			{
				return new Key(BaseMyChatToolsId);				
			}
			
				
		#endregion
	}
}
